import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SkYueJuVO, SkYueJuForm, SkYueJuQuery } from '@/api/app/SkYueJu/types';

/**
 * 查询约局信息列表
 * @param query
 * @returns {*}
 */

export const listSkYueJu = (query?: SkYueJuQuery): AxiosPromise<SkYueJuVO[]> => {
  return request({
    url: '/app/SkYueJu/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询约局信息详细
 * @param id
 */
export const getSkYueJu = (id: string | number): AxiosPromise<SkYueJuVO> => {
  return request({
    url: '/app/SkYueJu/' + id,
    method: 'get'
  });
};

/**
 * 新增约局信息
 * @param data
 */
export const addSkYueJu = (data: SkYueJuForm) => {
  return request({
    url: '/app/SkYueJu',
    method: 'post',
    data: data
  });
};

/**
 * 修改约局信息
 * @param data
 */
export const updateSkYueJu = (data: SkYueJuForm) => {
  return request({
    url: '/app/SkYueJu',
    method: 'put',
    data: data
  });
};

/**
 * 删除约局信息
 * @param id
 */
export const delSkYueJu = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/SkYueJu/' + id,
    method: 'delete'
  });
};


export const updateisHall = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/SkYueJu/updateisHall?id='+id,
    method: 'put'
  });
};

export const updateisHalljujue = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/SkYueJu/updateisHalljujue?id='+id,
    method: 'put'
  });
};

export const getShList = (): AxiosPromise<SkYueJuVO[]> => {
  return request({
    url: '/app/SkYueJu/getShList',
    method: 'get'
  });
};
